# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>

pkgname=linux-docs
pkgver=5.8
pkgrel=1
pkgdesc="Kernel hacker's manual"
url="https://www.kernel.org/doc/html/latest/"
arch=(any)
license=(GPL2)
makedepends=(xmlto python-sphinx python-sphinx_rtd_theme graphviz imagemagick)
source=(https://www.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/linux-$pkgver.tar.{xz,sign}
        sphinx-workaround.patch)
sha256sums=('e7f75186aa0642114af8f19d99559937300ca27acaf7451b36d4f9b0f85cf1f5'
            'SKIP'
            '8cb21e0b3411327b627a9dd15b8eb773295a0d2782b1a41b2a8839d1b2f5778c')
validpgpkeys=('ABAF11C65A2970B130ABE3C479BE3E4300411886'  # Linus Torvalds
              '647F28654894E3BD457199BE38DBBDC86092693E') # Greg Kroah-Hartman

prepare() {
  cd linux-$pkgver
  patch -p1 < ../sphinx-workaround.patch # https://bugs.archlinux.org/task/66156
}

build() {
  make -C linux-$pkgver htmldocs BUILDDIR="$srcdir/html"
}

package() {
  mkdir -p "$pkgdir"/usr/share/doc/linux/{txt,html}

  # Skip hidden files (no dotglob)
  cp -r linux-$pkgver/Documentation/* "$pkgdir/usr/share/doc/linux/txt"
  cp -r html/* "$pkgdir/usr/share/doc/linux/html"
}

# vim:set sw=2 et:
